<?php

define('IN',1);
require_once 'common.inc.php';
$cid = (int)$_GET['cid'];
$aid = (int)$_GET['aid'];

if( !$cid && !$aid )
{
	return;
}
else if(!$cid)
{
	$cid = cmsEntity::GetArticleType($aid);
}
$records = cmsEntity::GetListByCid($cid);
$record = '';


if(!$aid)
{
	$record = $records[0];
	$aid = $record['article_id'];
}
else
{
	$record = cmsEntity::GetRow($aid);
}

foreach($records as $key=>$val)
{
	if($val['article_id']==$aid)
	{
		$records[$key]['active'] = " class='ibm-active' ";
	}
}


$template->article_class = cmsEntity::GetTitle($cid);
$template->articles = $records;
$template->article = $record;
showMainFrontPage('front/article_detail');